package com.design.pattern.state.business;

import com.design.pattern.state.base.CarState;
import com.design.pattern.state.base.StateEnum;
import org.springframework.stereotype.Component;

/**
 * @author 王霄
 * @date 2021/12/8 14:18
 **/
@Component
public class StopCarState extends CarState {

    @Override
    public StateEnum getState() {
        return StateEnum.STOP;
    }

    @Override
    public void open() {
        context.setCurrentState(stateManager.get(StateEnum.OPEN));
        System.out.println("开门");
    }

    @Override
    public void run() {
        context.setCurrentState(stateManager.get(StateEnum.RUN));
        System.out.println("驾驶");
    }
}
